from telnetlib import DO

import numpy as np
from manim import *
from numpy import flip, insert
import math

LV, QL, QH, JH = '#75cfb8', '#bbdfc8', '#f0e5d8', '#ffc478'

class p1(ThreeDScene):
    def construct(self):
        # self.camera.frame.save_state()
        # self.add(NumberPlane())
        # self.camera.frame.rotate(13*DEGREES,about_point=[0.0, 0.0, 1.0])
        s=Square().stretch(2.5,0)
        a,b,c,d=s.get_boundary_point(UL),s.get_boundary_point(UR),s.get_boundary_point(DR),s.get_boundary_point(DL)
        p=[1,0.2,0]
        pa,pb,pc,pd=Line(p,a),Line(p,b),Line(p,c),Line(p,d)
        e,f=[1,1,0],[1,-1,0]
        self.add(s,pa,pb,pc,pd,
                 MathTex('A').next_to(s,UL),
                 MathTex('B').next_to(s,UR),
                 MathTex('C').next_to(s,DR),
                 MathTex('D').next_to(s,DL),
                 MathTex('P').next_to(p,RIGHT,buff=0.3),
                 )

class p2(ThreeDScene):
    def construct(self):
        # self.camera.frame.save_state()
        # self.add(NumberPlane())
        # self.camera.frame.rotate(13*DEGREES,about_point=[0.0, 0.0, 1.0])
        s=Square().stretch(2.5,0)
        a,b,c,d=s.get_boundary_point(UL),s.get_boundary_point(UR),s.get_boundary_point(DR),s.get_boundary_point(DL)
        p=[1,0.2,0]
        pa,pb,pc,pd=Line(p,a),Line(p,b),Line(p,c),Line(p,d)
        e,f=[1,1,0],[1,-1,0]
        self.add(s,pa,pb,pc,pd,
                 MathTex('A').next_to(s,UL),
                 MathTex('B').next_to(s,UR),
                 MathTex('C').next_to(s,DR),
                 MathTex('D').next_to(s,DL),
                 MathTex('P').next_to(p,RIGHT,buff=0.3),
                 DashedLine(e,f),
                 MathTex('E').next_to(e,UP),
                 MathTex('F').next_to(f,DOWN)
                 )